package cn.pku.sirx.snad.uias.dao;

import java.util.Set;

import cn.pku.sirx.snad.ad.dao.IDao;
import cn.pku.sirx.snad.uias.model.entity.Friend;

/**
 * @author WangXiao
 */
public interface IFriendDao extends IDao<Friend> {

	/**
	 * Check whether a user is a friend of another
	 * 
	 * @param fromUserId
	 *            a user ID
	 * @param toUserId
	 *            another user ID
	 * @return whether a user is a friend of another. If one of the parameters
	 *         is null, return false
	 */
	boolean isFriend(String fromUserId, String toUserId);

	/**
	 * Get a set of friend IDs of a given user.
	 * 
	 * @param userId
	 *            a user ID
	 * @return a set of friend IDs of a given user
	 */
	Set<String> getFriendIdSet(String userId);

	/**
	 * Get the friend count of a user
	 * 
	 * @param userId
	 *            a user ID
	 * @return the friend count of a user
	 */
	int getFriendCount(String userId);

	/**
	 * Get the count of common friends belonging to two users.
	 * 
	 * @param userId1
	 *            a user ID
	 * @param userId2
	 *            another user ID
	 * @return the count of common friends belonging to two users
	 */
	int getCommonFriendsCount(String userId1, String userId2);

}
